package gggameserver.games.khet;

import gggameserver.exceptions.GGIllegalMoveFormat;
import gggameserver.exceptions.GGTimeout;
import gggameserver.games.Move;
import gggameserver.games.Player;
import gggameserver.games.Result;

public class KhetPlayer extends Player {

	public KhetPlayer(KhetBoard board) {
		super(board);
	}

	@Override
	public Move getMove(long timeout) throws GGTimeout, GGIllegalMoveFormat {
		String cmd = KhetCommandFormatter.getGameCommandAsString(
				KhetCommandFormatter.GameStatus.Running, getPlayerNumber(),
				(KhetBoard) getBoard());
		this.sendCommand(cmd);

		return super.getMove(timeout);
	}

	@Override
	public void sendHandshake() {
		String cmd = KhetCommandFormatter.getGameCommandAsString(
				KhetCommandFormatter.GameStatus.Starting, getPlayerNumber(),
				(KhetBoard) getBoard());
		sendCommand(cmd);
		setHandshakeSent();
	}

	@Override
	public void sendStart(boolean starts) {
		// sends initial board at hand-shake
	}

	public void sendMove(Move move, boolean nextPlayer) {
		// get move sends board
	}

	public void sendResult(Result result) {
		String cmd = KhetCommandFormatter.getGameCommandAsString(
				KhetCommandFormatter.GameStatus.Ended, getPlayerNumber(),
				(KhetBoard) getBoard());
		sendCommand(cmd);
	}

}
